/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Testing;

import DAO.TagDAO;
import DAO.UserDAO;
import POJO.TagPOJO;
import POJO.UserPOJO;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.cassandra.thrift.Cassandra;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

/**
 *
 * @author node1
 */
public class MoveDataTag {
    public static void main(String[] args) throws Exception {
        try {
            TTransport tr = new TFramedTransport(new TSocket(Common.Constants.HOST, Common.Constants.PORT));
            TProtocol proto = new TBinaryProtocol(tr);
            Cassandra.Client client = new Cassandra.Client(proto);
            tr.open();

            client.set_keyspace(Common.Constants.KEYSPACE);
            TagDAO tag = TagDAO.getInstance(client);
            List<TagPOJO> listTag = tag.selectAllTag();
            for(int i = 0; i < listTag.size(); i++){
                TagPOJO tagP = listTag.get(i);
                tag.insertTagInfo(tagP.tagName, true);
                tag.insertListStatusInToTag(tagP.tagName, tagP.listStatusID);
            }
            tr.close();
        } catch (TException ex) {
            Logger.getLogger(apptien.class.getName()).log(Level.SEVERE, null, ex);
        }
    }    
}
